import { accountInfo, userInfo } from "@/type/user";
import request from "@/utils/request";

//查询当前登录用户的信息
export const getUserInfo = () => {
  return request({
    url: "/users/me",
    method: "get",
  });
};

//查询用户信息
export const getUserInfoById = (id: string) => {
  return request({
    url: `/users/${id}`,
    method: "get",
  });
};

//更新当前登录用户的信息
export const updateUserInfo = (data: userInfo) => {
  return request({
    url: "/users/info",
    method: "put",
    data,
  });
};

//更改当前账户信息
export const updateAccountInfo = (data: accountInfo) => {
  return request({
    url: "/users/account",
    method: "put",
    data,
  });
};
